# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Bruno Pagani <archange@archlinux.org>

_pkg=diff-match-patch
pkgname=python-${_pkg}
pkgver=20200713
pkgrel=6
pkgdesc="Robust algorithms to perform the operations required for synchronizing plain text"
arch=('any')
url="https://github.com/diff-match-patch-python/diff-match-patch"
license=('Apache')
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
sha256sums=('da6f5a01aa586df23dfc89f3827e1cafbb5420be9d87769eeb079ddfd9477a18')

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

check() {
  cd ${_pkg}-${pkgver}
  pytest
}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  find "${pkgdir}" -name *_py2.* -delete
  rm -r "${pkgdir}"$(python -c "import site; print(site.getsitepackages()[0])")/${_pkg//-/_}/tests
}
